package com.guavause.forwarding;

import com.google.common.collect.ForwardingList;
import com.google.common.collect.Lists;

import java.util.Collection;
import java.util.List;

/**
 * @author kxd
 * @date 2018/12/3 18:08
 * description:
 */
public class AddLoggingList<E> extends ForwardingList<E> {

    final List<E> delegate= Lists.newArrayList();

    @Override
    protected List<E> delegate() {
        return delegate;
    }

    @Override
    public void add(int index, E element) {

        log(index, element);
        super.add(index, element);
    }

    @Override
    public boolean add(E element) {
        return standardAdd(element);
    }

    @Override
    public boolean addAll(Collection<? extends E> c) {
        return standardAddAll(c);
    }

    private void log(int index, E element) {

    }

}
